#pragma once

#include "jacopo.musso.h"
#include "../common/basetypes.h"
#include "../common/MathUtils.h"

bool JacopoMusso::Init(Register& o_register)
{
	m_name = "JACOPO MUSSO";

	REGISTER_FUNC2(JacopoMusso, 1, 2);

	return true;
}

RetType JacopoMusso::Problem1()
{
	UInt32 sum = 0;
	for(int i = 2; i < 1000; ++i){
		sum += (i%3==0 || i%5==0) ? i : 0 ;
	}
	return sum;
}

RetType JacopoMusso::Problem2()
{
	UInt32 fib1 = 2;
	UInt32 fib2 = 3;
	UInt32 sum = 0;

	while (fib1 < 4000000)
	{
		if(!math::IsOdd(fib1))
			sum+= fib1;
		
		UInt32 temp = fib1 + fib2;
		fib1 = fib2;
		fib2 = temp;
	}
	return sum;
}